import { BroadCastCall } from "../broadCast/BroadCastCall";
import { MessageBlock } from "../../../../Framework/MQ/MessageBlock";
import { SPetBag } from "../../../../Message/Game/SPetBag";
import { EPlayerItemPosType } from "../../../../Message/Public/EPlayerItemPosType";
import { NetDispatcher } from "../../../mvc/core/NetDispatcher";
import { ServerCommand } from "../../mvc/ServerCommand";
//class PetBagCommand
    
    export  class PetBagCommand extends BroadCastCall
    {
        constructor(arg1: Object)
        {
            super(arg1);
            return;
        }

        public /* override */ call(arg1: MessageBlock): void
        {
            super.call(arg1);
            var loc1=arg1.messageBase as SPetBag;
            var loc2=loc1.posType;
            switch (loc2) 
            {
                case EPlayerItemPosType._EPlayerItemPosTypePet:
                {
                    _cache.pet.petBag = loc1;
                    NetDispatcher.dispatchCmd(ServerCommand.PetBagMsg, _cache.pet.petBag);
                    break;
                }
                case EPlayerItemPosType._EPlayerItemPosTypePetWarehouse:
                {
                    _cache.petWareHouse.petBag = loc1;
                    NetDispatcher.dispatchCmd(ServerCommand.PetWareHousePetChange, loc1);
                    break;
                }
            }
            return;
        }
    }
